package com.nus.fellowmark.dao;

import com.nus.fellowmark.entity.EnrollmentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 
 * 
 * @author Chen Ruoyi
 * @email chenruoyisz@gmail.com
 * @date 2023-02-10  
 */
@Mapper
public interface EnrollmentDao extends BaseMapper<EnrollmentEntity> {
	/**
     * select enrollments by student_id
     * @param studentId
     * @return
     */
    @Select("SELECT * FROM enrollment WHERE student_id=#{studentId}")
    List<EnrollmentEntity> selectByStudentId(Integer studentId);

    /**
     * select enrollments by module_id and student_id
     * @param (studentId,moduleId)
     * @return
     */
    @Select("SELECT * FROM enrollment WHERE student_id=#{studentId} AND module_id=#{moduleId}")
    EnrollmentEntity selectByStudentIdAndModuleId(Integer studentId, Integer moduleId);
}
